import request from '../utils/service';
///获得站点统计数据
export function getechartlist(param) {
    if (param.pagesize === undefined) {
        param.pagesize = 32;
    }
    if (param.page === undefined) {
        param.page = 1;
    }
    return request({
        url: `/ui/SysEchartEntity/queryEchartList`,
        method: 'post',
        data: param,
    });
}

export function getechartdetail(param) {
    return request({
        url: `/ui/SysEchartEntity/getEchartDetail?cid=` + param,
        method: 'get',
    });
}

export function commGetApi(url) {
    return request({
        url: url,
        method: 'get',
    });
}

export function commPostApi(url, param) {
    return request({
        url: url,
        method: 'post',
        data: param,
    });
}

export const reqdamVoCellStatistics = timestamp => {
    return ajax(
        `${base}/statistics/segment?currentTime=${timestamp}
`,
        'GET',
        {}
    );
};

export const reqdamCell = () =>
    ajax(
        `${base}/damVoSegment
`,
        'GET',
        {}
    );

export const reqBaseInfo = timestamp => {
    return ajax(
        `${base}/statistics/base?currentTime=${timestamp}
`,
        'GET',
        {}
    );
};
export const reqActual = () => {
    return ajax(
        `${base}/damVoPlanStatistics/actual
`,
        'GET',
        {}
    );
};
export const reqPlan = () => {
    return ajax(
        `${base}/damVoPlanStatistics/plan
`,
        'GET',
        {}
    );
};
export const reqWeekData = (curr, start, end) => {
    return ajax(
        `${base}/statistics/base/week?currentTime=${curr}&startTime=${start}&endTime=${end}
`,
        'GET',
        {}
    );
};

export const getWeekAllData = (curr, start, end) => {
    return ajax(
        `${base}/statistics/planProgress?currentTime=${curr}&startTime=${start}&endTime=${end}
`,
        'GET',
        {}
    );
};

export const reqProgress = (curr, start, end) => {
    return ajax(
        `${base}/statistics/pouringProgress?currentTime=${curr}&startTime=${start}&endTime=${end}
`,
        'GET',
        {}
    );
};

export const reqDesign = () => {
    return ajax(
        `${base}/simulation/design/model
`,
        'GET',
        {}
    );
};
export const reqActualProgress = (curr, start, end) => {
    return ajax(
        `${base}/simulation/pouring/actual
`,
        'GET',
        {}
    );
};

export const reqWeather = () => {
    // ajax(
    //     'https://devapi.qweather.com/v7/weather/3d?location=101271811&key=f61839fdbff34b96a2ee0b124ca5452c',
    //     'GET',
    //     {}
    // );
    return request({
        url:
            'https://devapi.qweather.com/v7/weather/7d?location=101271811&key=f61839fdbff34b96a2ee0b124ca5452c',
        method: 'get',
    });
};

export const reqCompare = (curr, start, end) => {
    return request({
        url: `/damVoPlanStatistics/compare?timeInterval=3`,
        method: 'GET',
    });
};
